import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { getNewDate } from '/@/api/travelItinerary/getDateAPI';

export const columns: BasicColumn[] = [
  //2
  {
    title: '终端类型',
    dataIndex: 'linkman',
    customRender: ({ text }) => {
      if (text === '票务') {
        return h(Tag, { color: 'green' }, () => 'PC');
      } else {
        return h(Tag, { color: 'green' }, () => 'APP');
      }
    },
  },
  //3
  { title: '出票日期', dataIndex: 'outTicketDate' },
  //4
  { title: '预定人姓名', dataIndex: 'bookerName' },
  //5
  { title: '预定人手机', dataIndex: 'bookerTel' },
  //6
  { title: '审批单号', dataIndex: 'exNum' },
  //7
  { title: '审批出发日期', dataIndex: 'exDepartureDate' },
  //8
  { title: '审批返回日期', dataIndex: 'exReturnDate' },
  //9
  { title: '员工编号', dataIndex: 'empNo' },
  //10
  { title: 'PNR', dataIndex: 'pnr' },
  //11
  { title: '全价', dataIndex: 'cabinAllPrice' },
  //12
  { title: '票号', dataIndex: 'tickerNo' },
  //13
  { title: '员工姓名', dataIndex: 'empName' },
  //14
  { title: '员工电话', dataIndex: 'empTel' },
  //15
  { title: '行程', dataIndex: 'voyage' },
  //16
  { title: '航班号', dataIndex: 'flightNum' },
  //17
  { title: '航空公司', dataIndex: 'carrierName', key: 'carrierName' },
  //18
  { title: '出发日期', dataIndex: 'deptDate' },
  //19
  { title: '出发时间', dataIndex: 'deptTime' },
  //20
  { title: '抵达日期', dataIndex: 'arriveDate' },
  //21
  { title: '抵达时间', dataIndex: 'arriveTime' },
  //22
  { title: '舱位', dataIndex: 'cabinCode', key: 'cabinCode' },
  //23
  { title: '机票价', dataIndex: 'salePrice', key: 'salePrice' },
  //24
  { title: '税（总）', dataIndex: 'taxSum', key: 'taxSum' },
  //25
  { title: '机票合计金额', dataIndex: 'planePriceSum', key: 'planePriceSum' },
  //26
  { title: '改期费', dataIndex: 'changeFee' },
  //27
  { title: '升舱费', dataIndex: 'changeUpFee' },
  //28
  { title: '改签费', dataIndex: 'changeUpFeechangeFee', key: 'changeUpFeechangeFee' },
  //29
  { title: '应退款(含税)', dataIndex: 'refundBeAmount' },
  //30
  { title: '保险', dataIndex: 'insurance', key: 'insurance' },
  //31
  { title: '折扣率', dataIndex: 'agio', key: 'agio' },
  //32
  { title: '服务费', dataIndex: 'ticketServicePrice', key: 'ticketServicePrice' },
  //33
  { title: '深白云扣款', dataIndex: 'priceBy', key: 'priceBy' },
  //34
  { title: '退票费(财务)', dataIndex: 'refundPrice' },
  //35
  { title: '应收', dataIndex: 'ticketPrice', key: 'ticketPrice' },
  //36
  { title: '总金额包含服务费', dataIndex: ' ticketPriceSum', key: ' ticketPriceSum' },
  //37
  {
    title: '是否结算',
    dataIndex: 'isSettlement',
    customRender: ({ text }) => {
      if (text === 0) {
        return h(Tag, { color: 'red' }, () => '未结算');
      } else if (text === 1) {
        return h(Tag, { color: 'green' }, () => '已结算');
      }
    },
  },
  //38
  {
    title: '白云对帐',
    dataIndex: 'isAccount',
    customRender: ({ text }) => {
      if (text === 0) {
        return h(Tag, () => '未对帐');
      } else if (text === 1) {
        return h(Tag, { color: 'red' }, () => '已对帐');
      }
    },
  },
  //39
  { title: '支付时间', dataIndex: 'payDate' },
  //40
  { title: '订票类型', dataIndex: 'bookingType' },
  //41
  { title: '机票类型', dataIndex: 'belongType' },
  //42
  { title: '备注', dataIndex: 'remark' },
  //43
  { title: '员工身份证号', dataIndex: 'empIdNum' },
  //44
  {
    title: '特别说明',
    // dataIndex: 'isOutLimit',
    key: 'isOutLimit',
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'empNo',
    label: '员工编号:',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      placeholder: ' ',
      style: 'width: 220px',
    },
  },
  {
    field: 'cabinCode',
    label: '舱位:',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      placeholder: ' ',
      style: 'width: 220px',
    },
  },
  {
    field: 'flightNum',
    label: '航班号:',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      placeholder: ' ',
      style: 'width: 220px',
    },
  },
  {
    field: 'orgName',
    label: '出发城市名称:',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      placeholder: ' ',
      style: 'width: 220px',
    },
  },
  {
    field: 'dstName',
    label: '到达城市名称:',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      placeholder: ' ',
      style: 'width: 220px',
    },
  },
  {
    field: 'bookingType',
    label: '订票类型:',
    component: 'Select',
    colProps: { span: 8 },
    componentProps: {
      placeholder: '请选择审批单状态',
      style: 'width: 220px',
      options: [
        { label: '出票单', value: '出票单' },
        { label: '改期单', value: '改期单' },
        { label: '退票单', value: '退票单' },
      ],
    },
  },
  {
    field: 'optDateStart',
    label: ' 操作时间:',
    component: 'Select',
    colProps: { span: 8 },
    defaultValue: getNewDate('before', 1),
    componentProps: {
      allowClear: false,
      style: 'width: 220px',
      options: [
        { label: '操作时间为近1个月内数据', value: getNewDate('before', 1) },
        { label: '操作时间为近3个月内数据', value: getNewDate('before', 3) },
        { label: '操作时间为近半年内数据', value: getNewDate('before', 6) },
        { label: '操作时间为近一年内数据', value: getNewDate('before', 12) },
      ],
    },
  },
  {
    field: 'outTicketDate',
    component: 'RangePicker',
    label: '出票时间:',
    colProps: {
      span: 8,
    },
    componentProps: {
      placeholder: ['出票时间起', '出票时间止'],
      style: 'width: 220px',
    },
  },
];
